<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Vendor
 *
 * @author tuancasi
 */
class Vendor extends CompanySource {

    //put your code here

    function defaultScope() {
	return array(
	    'condition' => "`type`= " . self::TYPE_VENDOR,
	);
    }

    /**
     * rewrite type
     */
    public function beforeValidate() {
	parent::beforeValidate();

	$this->type = self::TYPE_VENDOR;

//	if ($this->expireDate != '') {
//	    $this->expire_time = strtotime($this->expireDate);
//	}
	if ($this->title == '') {
	    $this->title = 'Vendor';
	}
	return true;
    }

    public function beforeSave() {
	parent::beforeSave();
	if ($this->title == '') {
	    $this->title = 'Vendor';
	}
	return true;
    }

}

